/*
 * MedicineList.java
 *
 * Created on August 31, 2008, 1:36 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package Project.bussiness;

import Project.DBHelper;
import java.sql.SQLException;
import java.util.Vector;

/**
 *
 * @author Hao Hao
 */
public class MedicineList {
    
    /** Creates a new instance of MedicineList */
private int MedicineID;
private int PrescriptionID;
private int Quantity;

    public int getMedicineID() {
        return MedicineID;
    }

    public void setMedicineID(int MedicineID) {
        this.MedicineID = MedicineID;
    }

    public int getPrescriptionID() {
        return PrescriptionID;
    }

    public void setPrescriptionID(int PrescriptionID) {
        this.PrescriptionID = PrescriptionID;
    }

    public int getQuantity() {
        return Quantity;
    }

    public void setQuantity(int Quantity) {
        this.Quantity = Quantity;
    }

    public static int insertMedicineList( MedicineList m) throws SQLException
    {
        int i;
        try{
            Vector paramList = new Vector();
            paramList.add(m.MedicineID);
            paramList.add(m.PrescriptionID);
            paramList.add(m.Quantity);
            i=DBHelper.executeUpdate("spInsertMedicineList",paramList);
        } catch(SQLException e)
        {
            throw e;
        }
        return i;
    }     
    
    public static int deleteMedicineList(int id) throws SQLException
    {
        int i;
        try{
            Vector paramList = new Vector();
            paramList.add(new Integer(id));
            i=DBHelper.executeUpdate("spDeleteMedicineListByID",paramList);
        } catch(SQLException e)
        {
            throw e;
        }
        return i;
    }      
}
